<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        localStorage.setItem("name","长沙吴彦祖");
        localStorage.setItem("age",21);
        localStorage.setItem("sex","男");
        localStorage.setItem("height",181);

        console.log(localStorage.getItem("age"));;

        for(var i=0;i<localStorage.length;i++){
            var key=localStorage.key(i);
            console.log(key);
            var value=localStorage.getItem(key);
            console.log(value);
        }

        localStorage.removeItem("age");

        localStorage.clear();
    </script>
</body>
</html>